package com.work.demo.test;/*
 *@title IscFudataUtil
 *@description
 *@author fulls
 *@version 1.0
 *@create 2024/5/10 11:40
 */


import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;


import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

@Slf4j
public class IscFudataUtil {
    private static final Map<Long,String> uuidMap = new HashMap<>();

    public static Long id2Long(String strId) {
        try {
            String md5Id = DigestUtils.md5Hex(strId);
            UUID uUuid = UUID.fromString(md5Id.replaceFirst("(\\p{XDigit}{8})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}{4})(\\p{XDigit}+)", "$1-$2-$3-$4-$5"));
            Long lUuid = (uUuid.getMostSignificantBits() & 4294967295L) << 32 | uUuid.getLeastSignificantBits() & 4294967295L;
            lUuid = lUuid & Long.MAX_VALUE;
            uuidMap.put(lUuid, strId);
            return lUuid;
        } catch (Exception var4) {
            var4.printStackTrace();
            throw var4;
        }
    }
}
